-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Document sort direction and null order in Iceberg #24554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
okumin
commented
Dec 21, 2024
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this SQL in my local machine.
trino> CREATE TABLE iceberg.default.orders (
-> order_id BIGINT,
-> order_date DATE,
-> account_number BIGINT,
-> customer VARCHAR,
-> country VARCHAR)
-> WITH (sorted_by = ARRAY['order_date DESC NULLS FIRST', 'order_id ASC NULLS LAST'])
-> ;
CREATE TABLE
trino>
$ hdfs dfs -cat /user/hive/warehouse/orders-5fae815b97d54add91c0100370e56f0c/metadata/00000-cf46fb4f-226b-42dc-b640-c14d9e000c09.metadata.json
...
"schemas" : [ {
"type" : "struct",
"schema-id" : 0,
"fields" : [ {
"id" : 1,
"name" : "order_id",
"required" : false,
"type" : "long"
}, {
"id" : 2,
"name" : "order_date",
"required" : false,
"type" : "date"
}, {
"id" : 3,
"name" : "account_number",
"required" : false,
"type" : "long"
}, {
"id" : 4,
"name" : "customer",
"required" : false,
"type" : "string"
}, {
"id" : 5,
"name" : "country",
"required" : false,
"type" : "string"
} ]
} ],
...
"default-sort-order-id" : 1,
"sort-orders" : [ {
"order-id" : 1,
"fields" : [ {
"transform" : "identity",
"source-id" : 2,
"direction" : "desc",
"null-order" : "nulls-first"
}, {
"transform" : "identity",
"source-id" : 1,
"direction" : "asc",
"null-order" : "nulls-last"
} ]
} ],
Contributor
Author
ebyhr
reviewed
Dec 21, 2024
131360e to
c67245c
Compare
Contributor
Author
|
Thanks. I made two changes.
|
Contributor
Author
|
Thanks for reviewing and merging my PR. It will hopefully help future users 🙏 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Description
A trivial doc update to describe how users can explicitly specify sort directions or null ordering when we create a sorted table of Apache Iceberg.
Additional context and related issues
We found no Trino document mentioning the advanced parameters of
sorted_bywhile developing Apache Hive. Simply, we misunderstood that Trino would not have the capability at first glance. I believe some people would love the information.Release notes
(x) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text: